{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c6dca9d8-aabf-466e-ad35-31fec5211f7d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "BENIGN.csv: 113065 行\n",
      "DrDoS_DNS.csv: 30618 行\n",
      "DrDoS_LDAP.csv: 14508 行\n",
      "DrDoS_MSSQL.csv: 18054 行\n",
      "DrDoS_NTP.csv: 129285 行\n",
      "DrDoS_NetBIOS.csv: 15363 行\n",
      "DrDoS_SNMP.csv: 13563 行\n",
      "DrDoS_UDP.csv: 19413 行\n",
      "LDAP.csv: 41801 行\n",
      "MSSQL.csv: 25280 行\n",
      "NetBIOS.csv: 16252 行\n",
      "Portmap.csv: 42606 行\n",
      "Syn.csv: 356496 行\n",
      "TFTP.csv: 227223 行\n",
      "UDP.csv: 33695 行\n",
      "UDP-lag.csv: 33294 行\n",
      "UDPLag.csv: 83 行\n",
      "WebDDoS.csv: 51 行\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "\n",
    "# 设置包含CSV文件的目录\n",
    "directory = 'class_split'  # 替换为您的目录路径\n",
    "\n",
    "# 列出目录下所有的CSV文件\n",
    "csv_files = [f for f in os.listdir(directory) if f.endswith('.csv')]\n",
    "\n",
    "# 读取每个CSV文件并打印行数\n",
    "for csv_file in csv_files:\n",
    "    file_path = os.path.join(directory, csv_file)\n",
    "    try:\n",
    "        # 读取CSV文件\n",
    "        data = pd.read_csv(file_path)\n",
    "        # 获取行数\n",
    "        num_rows = len(data)\n",
    "        print(f\"{csv_file}: {num_rows} 行\")\n",
    "    except Exception as e:\n",
    "        print(f\"无法读取 {csv_file}: {e}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1b2fb846-4ca5-4593-a6e1-40bf82817d80",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
